{{define "dashboard/monitor"}} {{template "common/header" .}} {{template "common/menu" .}}
  <div class="nb-container">
    <div class="ui container">
      <div class="ui grid">
        <div class="right floated right aligned twelve wide column">
          <button class="ui right labeled probe-primary-btn icon button" onclick="addOrEditMonitor()">
            <i class="add icon"></i> 添加服务
          </button>
        </div>
      </div>
      <table class="ui very basic table">
        <thead>
          <tr>
            <th>ID</th>
            <th>名称</th>
            <th>目标</th>
            <th>覆盖范围</th>
            <th>特定服务器</th>
            <th>类型</th>
            <th>请求间隔</th>
            <th>通知</th>
            <th>管理</th>
          </tr>
        </thead>
        <tbody>
          {{range $monitor := .Monitors}}
          <tr>
            <td>{{$monitor.ID}}</td>
            <td>{{$monitor.Name}}</td>
            <td>{{$monitor.Target}}</td>
            <td>{{if eq $monitor.Cover 0}}覆盖所有{{else}}忽略所有{{end}}</td>
            <td>{{$monitor.SkipServersRaw}}</td>
            <td>
              {{if eq $monitor.Type 1}}HTTP(S)/SSL证书 {{else if eq $monitor.Type 2}} ICMP Ping {{else}} TCP 端口 {{end}}
            </td>
            <td>{{$monitor.Duration}}秒</td>
            <td>{{$monitor.Notify}}</td>
            <td>
              <div class="ui mini icon buttons">
                <button class="ui button" onclick="addOrEditMonitor({{$monitor}})">
                  <i class="edit icon"></i>
                </button>
                <button class="ui button"
                  onclick="showConfirm('删除服务','确认删除此服务？',deleteRequest,'/api/monitor/'+{{$monitor.ID}})">
                  <i class="trash alternate outline icon"></i>
                </button>
              </div>
            </td>
          </tr>
          {{end}}
        </tbody>
      </table>
    </div>
  </div>
  {{template "component/monitor"}} {{template "common/footer" .}}
  <script>
    $(".checkbox").checkbox();
  </script>
  {{end}}